package org.seckill.service;

import org.seckill.dto.Exposer;
import org.seckill.dto.SeckillExcution;
import org.seckill.entity.Seckill;
import org.seckill.exception.RepeatKillException;
import org.seckill.exception.SeckillCloseException;
import org.seckill.exception.SeckillException;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by chenhui479 on 16/11/20.
 */


public interface SeckillService {

    /**
     * 查询所有秒杀
     * @return
     */
    List<Seckill> getSeckillList();


    /**
     * 查询单个秒杀
     * @param seckiilId
     * @return
     */
    Seckill getById(long seckiilId);

    /**
     * 秒杀开始输出接口地址，否则输出系统时间
     * @param seckillId
     */

    Exposer exportSeckillUrl(long seckillId);

    /**
     * 执行秒杀
     * @param seckillId
     * @param userPhone
     * @param md5
     */
    SeckillExcution excuteSeckill (long seckillId, long userPhone, String md5) throws SeckillException,RepeatKillException,SeckillCloseException;

    /**
     *执行秒杀
     * @param seckillId
     * @param userPhone
     * @param md5
     * @return
     * @throws SeckillException
     */

    SeckillExcution excuteSeckiillProcdure (long seckillId, long userPhone, String md5)throws SeckillException;
}
